<form class="form-horizontal validate" role="form" method="post" action="content/savechannel">
	<input type="hidden" name="id" value="<?php echo $rs['id']?>">
	<div class="form-group">
		<label class="col-sm-2 control-label">名称</label>
		<div class="col-sm-10">
			<input type="text" class="form-control" name="name" value="<?php echo $rs['name']?>" data-validate="required" data-message-required="分类名称不能为空">
		</div>
	</div>
    <!--div class="form-group">
		<label class="col-sm-2 control-label">URL自定义</label>
		<div class="col-sm-10">
			<input type="text" class="form-control input-lg easyui-validatebox"  name="en_name" value="<?php echo $rs['en_name']?>" 
            data-options="required:true,validType:{remote:['<?php echo WEB.'content/iscatepinyin?id='.$rs['id']?>','en_name']},invalidMessage:'URL已存在，请修改'">
		</div>
	</div-->
	<div class="form-group">
		<label class="col-sm-2 control-label">上级分类</label>
		<input type="hidden" name="parent_id" value="<?php echo $rs['parent_id']?>" />
		<div class="col-sm-10">
			<div class="dropdown">
				<button class="btn btn-primary dropdown-toggle" data-toggle="dropdown"><span id="cateName"><?php echo $rs['cateName']?$rs['cateName']:'顶级分类';?></span> <span class="caret"></span></button>
				<div class="dropdown-menu">
					<div class="scrollable" data-height="150" data-width="300">
						<div id="cateTree" class="aciTree aciTreeFullRow" style="min-height: 70px;"></div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!--
	<div class="form-group">
		<label class="col-sm-2 control-label">显示类型</label>
		<div class="col-sm-10">
			<select name="list_type" class="selectboxit" data-first-option="true" value="<?php echo $rs['list_type']?>">
				<option value="1" <?php echo $rs['list_type']==1?'selected':''; ?>>网页列表</option>
				<option value="2" <?php echo $rs['list_type']==2?'selected':''; ?>>微信图文</option>
				<option value="3" <?php echo $rs['list_type']==3?'selected':''; ?>>外部链接</option>
				<option value="4" <?php echo $rs['list_type']==4?'selected':''; ?>>微信文本</option>
			</select>
		</div>
	</div>
	-->
    <div class="form-group">
		<label class="col-sm-2 control-label">外部链接</label>
		<div class="col-sm-10">
			<input type="text" class="form-control" name="external_url" data-validate="url" value="<?php echo $rs['external_url']?>">
		</div>
	</div>
	<!--div class="form-group">
		<label class="col-sm-2 control-label">显示到PC:</label>
		<div class="col-sm-10">
			<div class="btn-group" data-toggle="buttons">
				<label class="btn btn-default <?php echo $rs['show_pc']!=2?'active':''?>"><input type="radio" name="show_pc" value="1" <?php echo $rs['show_pc']!=2?'checked':''?>>是</label>
				<label class="btn btn-default <?php echo $rs['show_pc']==2?'active':''?>"><input type="radio" name="show_pc" value="2" <?php echo $rs['show_pc']==2?'checked':''?>>否</label>
			</div>
		</div>
	</div>
    <div class="form-group">
		<label class="col-sm-2 control-label">显示到微信:</label>
		<div class="col-sm-10">
			<div class="btn-group" data-toggle="buttons">
				<label class="btn btn-default <?php echo $rs['show_wechat']!=2?'active':''?>"><input type="radio" name="show_wechat" value="1" <?php echo $rs['show_wechat']!=2?'checked':''?>>是</label>
				<label class="btn btn-default <?php echo $rs['show_wechat']==2?'active':''?>"><input type="radio" name="show_wechat" value="2" <?php echo $rs['show_wechat']==2?'checked':''?>>否</label>
			</div>
		</div>
	</div>
    <div class="form-group">
		<label class="col-sm-2 control-label">显示到APP:</label>
		<div class="col-sm-10">
			<div class="btn-group" data-toggle="buttons">
				<label class="btn btn-default <?php echo $rs['show_app']!=2?'active':''?>"><input type="radio" name="show_app" value="1" <?php echo $rs['show_app']!=2?'checked':''?>>是</label>
				<label class="btn btn-default <?php echo $rs['show_app']==2?'active':''?>"><input type="radio" name="show_app" value="2" <?php echo $rs['show_app']==2?'checked':''?>>否</label>
			</div>
		</div>
	</div-->
    
</form>

<script>
/**$('[name=name]').blur(function(){
	if($('[name=name]').val()!=''){							
		$.post(WEB+'content/pinyin',{word:$('[name=name]').val()},function(c){
			$('[name=en_name]').val(c);											  
		});
	}
});**/
//$('.selectboxit').combobox();
$('#cateTree').aciTree({
    ajax: {url: 'content/getchannel?self=<?php echo $rs['id']?>&pid=<?php echo $pid?>'},
    selectable: true
}).on('acitree', function(event, api, item, eventName, options){
	if(eventName=='selected'){
		var itemData = api.itemData(item);
		$('#cateName').text(itemData.label);
		$('[name=parent_id]').val(itemData.id);
	}
});
$(".dropdown-menu").on("click", ".aciTreeButton", function(e) {
    e.stopPropagation();
});
</script>